$(document).ready(function(){
	mycenter.init()
});



var mycenter = {
	init:function(){
		this.PageLoadClose();
		this.checkBindStatus()
	},
	PageLoadClose:function(){
		LoadingIcon = layer.load();
		layer.close(LoadingIcon);	
	},
	checkBindStatus:function(){
		var _this = this
		setInterval(function(){
			_this.getAjax('/my/checkBindStatus','',function(res){
				if(res.respCode == 1){
					window.location.href = '/pc/myorderlist?type=myCenter'
				}
			})
		},1000)
		
	},

	getAjax(url,params,fn){
		$.ajax({
		  dataType : "json",
	      url: basePath + url,
	      type: 'GET',
	      data: params ? JSON.stringify(params) : '',
	      xhrFields: {
	        withCredentials: true
	      },
	      contentType : "application/json",
	      success: function(res) {
	      	if ( fn ){
	      		fn(res)
	      	}
	      }
	    })		
	}

}
